import request from '@/config/axios'

export interface MaterialVO {
  id: number
  materialName: string
  localUrl: string
  wecomUrl: string
}

// 查询素材列表
export const getMaterialPage = async (params) => {
  return await request.get({ url: `/wecom/material/page`, params })
}

// 查询素材详情
export const getMaterial = async (id: number) => {
  return await request.get({ url: `/wecom/material/get?id=` + id })
}

// 新增素材
export const createMaterial = async (data) => {
  return await request.post({ url: `/wecom/material/create`, data })
}

// 修改素材
export const updateMaterial = async (data: MaterialVO) => {
  return await request.put({ url: `/wecom/material/update`, data })
}

// 删除素材
export const deleteMaterial = async (id: number) => {
  return await request.delete({ url: `/wecom/material/delete?id=` + id })
}

// 导出素材 Excel
export const exportMaterial = async (params) => {
  return await request.download({ url: `/wecom/material/export-excel`, params })
}
